File: maxima.info, Node: Rules and Patterns, Next: Lists, Prev: Miscellaneous Options, Up: Top
Rules and Patterns
******************
* Menu:
* Introduction to Rules and Patterns::
* Definitions for Rules and Patterns::
File: maxima.info, Node: Introduction to Rules and Patterns, Next: Definitions for Rules and Patterns, Prev: Rules and Patterns, Up: Rules and Patterns
Introduction to Rules and Patterns
==================================
This section discusses user defined pattern matching and
simplification rules (set up by TELLSIMP, TELLSIMPAFTER, DEFMATCH, or,
DEFRULE.) You may affect the main simplification procedures, or else
have your rules applied explicityly using APPLY1 and APPLY2. There
are additional mechanisms for polynomials rules under TELLRAT, and for
commutative and non commutative algebra in chapter on AFFINE.
File: maxima.info, Node: Definitions for Rules and Patterns, Prev: Introduction to Rules and Patterns, Up: Rules and Patterns
Definitions for Rules and Patterns
==================================
- Function: APPLY1 (exp, rule1, ..., rulen)
repeatedly applies the first rule to exp until it fails, then
repeatedly applies the same rule to all subexpressions of exp,
left-to-right, until the first rule has failed on all
subexpressions. Call the result of transforming exp in this
manner exp'. Then the second rule is applied in the same fashion
starting at the top of exp'. When the final rule fails on the
final subexpression, the application is finished.
- Function: APPLY2 (exp, rule1, ..., rulen)
differs from APPLY1 in that if the first rule fails on a given
subexpression, then the second rule is repeatedly applied, etc.
Only if they all fail on a given subexpression is the whole set of
rules repeatedly applied to the next subexpression. If one of the
rules succeeds, then the same subexpression is reprocessed,
starting with the first rule. MAXAPPLYDEPTH[10000] is the maximum
depth to which APPLY1 and APPLY2 will delve.
- Function: APPLYB1 (exp, rule1, ..., rulen)
is similar to APPLY1 but works from the "bottom up" instead of
from the "top down". That is, it processes the smallest
subexpression of exp, then the next smallest, etc.
MAXAPPLYHEIGHT[10000] - is the maximum height to which APPLYB1 will
reach before giving up.
- Variable: CURRENT_LET_RULE_PACKAGE
default:[DEFAULT_LET_RULE_PACKAGE] - the name of the rule package
that is presently being used. The user may reset this variable to
the name of any rule package previously defined via the LET
command. Whenever any of the functions comprising the let package
are called with no package name the value of
CURRENT_LET_RULE_PACKAGE
is used. If a call such as LETSIMP(expr,rule_pkg_name); is made,
the rule package rule_pkg_name is used for that LETSIMP command
only, i.e. the value of CURRENT_LET_RULE_PACKAGE is not changed.
- Variable: DEFAULT_LET_RULE_PACKAGE
- the name of the rule package used when one is not explicitly set